GXNewPaperType
(9-Jan-97)GXNewPaperType
, but for some reason the new papertype
doesn't show up in the page set-up dialog.GXNewPaperType
to create an application-defined paper
type, GX doesn't find it in the page set-up dialog as it should. This is
because GX is setting up the paper type flags incorrectly. But there is a
workaround...
You need to create a job and custom paperType and flatten it to a file
within the extensions folder. GXNewPaperType
will create a valid
paperType, but it does not set up the creator and the paperType flags
correctly. Therefore, after calling GXNewPaperType
to set up the new
custom paperType, you'll need to set the paperTypeFlags and the creator.
The following code fragments will do the trick.
The globals used to set up the creator and paperType flags:
OSErr collectionErr = noErr; Str255 paperTypeName; gxRectangle paperDims; gxRectangle pageDims; Collection paperTypeCollection; gxFlagsInfo paperTypeFlags; gxCreatorInfo paperTypeCreator; // // We use this information to check to make sure that our // new paperType was set up as we thought after calling GXNewPaperType // GXGetPaperTypeName( theNewPaperType, paperTypeName ); GXGetPaperTypeDimensions( theNewPaperType, &pageDims, &paperDims); // // We need to set our new paperType's flags and creator to allow // GX to recognize it. // paperTypeCollection = GXGetPaperTypeCollection( theNewPaperType ); paperTypeFlags.flags = gxOldAndNewPaperTypeFlag; collectionErr = AddCollectionItem( paperTypeCollection, gxFlagsTag, gxPrintingTagID, sizeof(gxFlagsInfo), &paperTypeFlags ); paperTypeCreator.creator = gxUserPaperType; collectionErr = AddCollectionItem( paperTypeCollection, gxCreatorTag, gxPrintingTagID, sizeof(gxCreatorInfo), &paperTypeCreator );
At this point, when a print dialog is displayed, the paperType list is recreated each time. This behavior ensures that any newly created paperType will be found from within a running app which is creating paperTypes.
After you have created the custom paperType and valid job, you'll need to
call GXFlattenJob
and GXFlattenPaperType
and save this info into a file
within the extension folder. Then it should show up in your page setup
paper type list.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help